#include "gfx.h"

#ifndef UGLY_HACK_FOR_THOSE_WHO_DONT_KNOW_HOWTO_INSTALL_SDL
#include <SDL/SDL.h>
#else
#include <SDL.h>
#endif

void gfx_init()
{
    if( SDL_InitSubSystem( SDL_INIT_VIDEO ) == -1 )
    {
        log_printf(LOG_ERR, "Couldn't initialize SDL video submodule: %s", SDL_GetError());
		return ;
	}
    gfx_image_init();
    log_puts(LOG_DBG, "Done initializing gfx module");
    gfx_image_load("data/gfx/icon.bmp");
    GFX_Image *image = gfx_image_get("gfx_icon");
    if(image)
    {
        SDL_WM_SetIcon(image->image, 0);
    }
    SDL_WM_SetCaption("AsterioTauros", 0);
}

void gfx_exit()
{
    gfx_image_exit();
    SDL_QuitSubSystem(SDL_INIT_VIDEO);
    log_puts(LOG_DBG, "Done uninitializing gfx module");
}
